
Partial Class Controls_SimpleRating
    Inherits System.Web.UI.UserControl

    Public Event Rating(ByVal sender As Object, ByVal e As System.EventArgs)

    Protected Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
        If Me.CheckBox1.Checked Then
            Me.CheckBox2.Checked = Not Me.CheckBox1.Checked
        End If
        RaiseEvent Rating(Me, Nothing)
    End Sub

    Protected Sub CheckBox2_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
        If Me.CheckBox2.Checked Then
            Me.CheckBox1.Checked = Not Me.CheckBox2.Checked
        End If
        RaiseEvent Rating(Me, Nothing)
    End Sub

    Public Property TextoOpcao1() As String
        Get
            Return Me.CheckBox1.Text
        End Get
        Set(ByVal value As String)
            Me.CheckBox1.Text = value
        End Set
    End Property

    Public Property TextoOpcao2() As String
        Get
            Return Me.CheckBox2.Text
        End Get
        Set(ByVal value As String)
            Me.CheckBox2.Text = value
        End Set
    End Property

    Public Property TextoQuestao() As String
        Get
            Return Me.lblQuestion.Text
        End Get
        Set(ByVal value As String)
            Me.lblQuestion.Text = value
        End Set
    End Property

    Public Sub Reset()
        Me.CheckBox1.Checked = False
        Me.CheckBox2.Checked = False
    End Sub

    Private _Valor As Integer
    Public ReadOnly Property Valor() As Integer
        Get
            If Me.CheckBox1.Checked = False And Me.CheckBox2.Checked = False Then
                _Valor = -1
            ElseIf Me.CheckBox1.Checked Then
                _Valor = 5
            ElseIf Me.CheckBox2.Checked Then
                _Valor = 1
            End If
            Return _Valor
        End Get
    End Property

End Class
